<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Object.create()方法实现继承</title>
</head>

<body>
  <script>
    function Plane(w, h, x, y) {
      this.width = w;
      this.height = h;
      this.x = x;
      this.y = y;
    }
    Plane.prototype.move = function () {
      console.log('飞机，走你');
    }

    let p = new Plane(22, 33, 44, 55)
    console.log(p); //Plane {width: 22, height: 33, x: 44, y: 55}


    // Object.create(源对象)， 返回一个新对象，新对象的原型对象指向源对象
    let n = Object.create(p)
    console.log(n);
    // Object.assign()没有遍历原型链上的属性和方法的。只是遍历了对象自身的属性和方法。
  </script>
</body>

</html>